/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "poste")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Poste.findAll", query = "SELECT p FROM Poste p"),
    @NamedQuery(name = "Poste.findByNomPoste", query = "SELECT p FROM Poste p WHERE p.nomPoste = :nomPoste"),
    @NamedQuery(name = "Poste.findByDepartement", query = "SELECT p FROM Poste p WHERE p.departement = :departement"),
    @NamedQuery(name = "Poste.findByNombreDHeures", query = "SELECT p FROM Poste p WHERE p.nombreDHeures = :nombreDHeures"),
    @NamedQuery(name = "Poste.findByNomEse", query = "SELECT p FROM Poste p WHERE p.nomEse = :nomEse"),
    @NamedQuery(name = "Poste.findByNomEseByNomPoste", query = "SELECT p FROM Poste p WHERE p.nomEse = :nomEse AND p.nomPoste = :poste"),
    @NamedQuery(name = "Poste.findBySalaireMoyen", query = "SELECT p FROM Poste p WHERE p.salaireMoyen = :salaireMoyen")})
public class Poste implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NOM_POSTE")
    private String nomPoste;
    @Basic(optional = false)
    @Column(name = "DEPARTEMENT")
    private String departement;
    @Basic(optional = false)
    @Column(name = "NOMBRE_D_HEURES")
    private int nombreDHeures;
    @Basic(optional = false)
    @Column(name = "SALAIRE_MOYEN")
    private int salaireMoyen;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nomPoste")
    private Collection<Historique> historiqueCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "poste")
    private Collection<Exiger2> exiger2Collection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "poste")
    private Collection<Exiger1> exiger1Collection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "poste")
    private Collection<Exiger4> exiger4Collection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "poste")
    private Collection<Exiger3> exiger3Collection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nomPoste")
    private Collection<OffreDEmploi> offreDEmploiCollection;
    @JoinColumn(name = "NOM_ESE", referencedColumnName = "NOM_ESE")
    @ManyToOne(optional = false)
    private Entreprise nomEse;

    public Poste() {
    }

    public Poste(String nomPoste) {
        this.nomPoste = nomPoste;
    }

    public Poste(String nomPoste, String departement, int nombreDHeures, int salaireMoyen) {
        this.nomPoste = nomPoste;
        this.departement = departement;
        this.nombreDHeures = nombreDHeures;
        this.salaireMoyen = salaireMoyen;
    }

    public String getNomPoste() {
        return nomPoste;
    }

    public void setNomPoste(String nomPoste) {
        this.nomPoste = nomPoste;
    }

    public String getDepartement() {
        return departement;
    }

    public void setDepartement(String departement) {
        this.departement = departement;
    }

    public int getNombreDHeures() {
        return nombreDHeures;
    }

    public void setNombreDHeures(int nombreDHeures) {
        this.nombreDHeures = nombreDHeures;
    }

    public int getSalaireMoyen() {
        return salaireMoyen;
    }

    public void setSalaireMoyen(int salaireMoyen) {
        this.salaireMoyen = salaireMoyen;
    }

    @XmlTransient
    public Collection<Historique> getHistoriqueCollection() {
        return historiqueCollection;
    }

    public void setHistoriqueCollection(Collection<Historique> historiqueCollection) {
        this.historiqueCollection = historiqueCollection;
    }

    @XmlTransient
    public Collection<Exiger2> getExiger2Collection() {
        return exiger2Collection;
    }

    public void setExiger2Collection(Collection<Exiger2> exiger2Collection) {
        this.exiger2Collection = exiger2Collection;
    }

    @XmlTransient
    public Collection<Exiger1> getExiger1Collection() {
        return exiger1Collection;
    }

    public void setExiger1Collection(Collection<Exiger1> exiger1Collection) {
        this.exiger1Collection = exiger1Collection;
    }

    @XmlTransient
    public Collection<Exiger4> getExiger4Collection() {
        return exiger4Collection;
    }

    public void setExiger4Collection(Collection<Exiger4> exiger4Collection) {
        this.exiger4Collection = exiger4Collection;
    }

    @XmlTransient
    public Collection<Exiger3> getExiger3Collection() {
        return exiger3Collection;
    }

    public void setExiger3Collection(Collection<Exiger3> exiger3Collection) {
        this.exiger3Collection = exiger3Collection;
    }

    @XmlTransient
    public Collection<OffreDEmploi> getOffreDEmploiCollection() {
        return offreDEmploiCollection;
    }

    public void setOffreDEmploiCollection(Collection<OffreDEmploi> offreDEmploiCollection) {
        this.offreDEmploiCollection = offreDEmploiCollection;
    }

    public Entreprise getNomEse() {
        return nomEse;
    }

    public void setNomEse(Entreprise nomEse) {
        this.nomEse = nomEse;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nomPoste != null ? nomPoste.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Poste)) {
            return false;
        }
        Poste other = (Poste) object;
        if ((this.nomPoste == null && other.nomPoste != null) || (this.nomPoste != null && !this.nomPoste.equals(other.nomPoste))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Poste[ nomPoste=" + nomPoste + " ]";
    }
}
